<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <!-- <a download href="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2632761637,690791581&fm=26&gp=0.jpg">下载</a> -->

  <script>
    function download(url) {
      const xhr = new XMLHttpRequest();
      xhr.open('GET', url);
      xhr.responseType = 'blob';
      xhr.send();
      xhr.onload = function () {
        const fileBlob = xhr.response;
        const fileUrl = URL.createObjectURL(fileBlob);
        const aDom = document.createElement("a");
        aDom.setAttribute('href', fileUrl);
        aDom.innerHTML = '下载';
        aDom.setAttribute('download', '');
        document.body.appendChild(aDom);
      }
    }
    const imgUrl = 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2632761637,690791581&fm=26&gp=0.jpg'
    download(imgUrl)
  </script>
</body>

</html>